//
//  EFAMatSelTCell.m
//  efairy
//
//  Created by XiangDongMBP on 2017/9/6.
//  Copyright © 2017年 East. All rights reserved.
//

#import "EFAMatSelTCell.h"
#import "EFAModel.h"

@implementation EFAMatSelTCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)configViewWithMtcPubModel:(EFAMtcPubModel *)model indexPath:(NSIndexPath *)indexPath {
    if (indexPath.section == 0) {
        self.titleLabel.text = @"维护类型";
        NSString *subTitleStr = model.mt_type_name;
        self.subTitleLabel.text = subTitleStr ? subTitleStr : @"请选择";
        return;
    }
    
    NSArray *array = @[@"维护结果", @"是否现场处理"];
    if (indexPath.row < array.count) {
        self.titleLabel.text = array[indexPath.row];
        
        if (indexPath.row == 0) {
            self.titleLabel.text = model.mt_handle_title;
            NSString *subTitleStr = model.mt_handle_name;
            self.subTitleLabel.text = subTitleStr ? subTitleStr : @"请选择";
        } else {
            self.subTitleLabel.text = model.efairymtrecord_is_insite_handle ? @"是" : @"否";
        }
    }
}

@end

@implementation EFAMatSelTCell (AlarmRelative)
- (void)configViewWithAlarmPubModel:(EFAAlarmPubModel *)model indexPath:(NSIndexPath *)indexPath {
    if (indexPath.section == 0) {
        self.titleLabel.text = @"报警类型";
        NSArray *alarmType = @[@"离线", @"火警", @"预警", @"故障", @"启动", @"屏蔽"];
        if (model.efairyalarmrecord_alarm_id && model.efairyalarmrecord_alarm_id < alarmType.count) {
            self.subTitleLabel.text = alarmType[model.efairyalarmrecord_alarm_id];
        } else {
            self.subTitleLabel.text = @"请选择";
        }
        return;
    }
    
    NSArray *array = @[@"隐患是否排除", @"是否现场处理"];
    if (indexPath.row < array.count) {
        self.titleLabel.text = array[indexPath.row];
        if (indexPath.row == 0) {
            self.subTitleLabel.text = model.efairyalarmrecord_is_handle ? @"是" : @"否";
        } else {
            self.subTitleLabel.text = model.efairyalarmrecord_is_insite_handle ? @"是" : @"否";
        }
    }
}
@end

@implementation EFAMatSelTCell (DangerRelative)
- (void)configViewWithDangerPubModel:(EFADangerPubModel *)model indexPath:(NSIndexPath *)indexPath {
    NSArray *array = @[@"所属项目", @"隐患是否排查"];
    if (indexPath.row < array.count) {
        self.titleLabel.text = array[indexPath.row];
        if (indexPath.row == 0) {
            self.subTitleLabel.text = model.efairyhiddendanger_project_name;
        } else {
            self.subTitleLabel.text = model.efairyhiddendanger_is_fixed ? @"是" : @"否";
        }
    }
}
@end
